<template>
  <div class="granary-list-item-type-one" @click="goToHomeItem(id)">
    <div class="left-img">
      <van-image width="65px" height="65px" radius="15" lazy-load fit="cover" :src="orign" />
    </div>

    <div class="right-text">
      <div class="title">
        <div v-html="digest"></div>
      </div>
      <div class="tag">
        <span>#{{ tag }}</span>
      </div>
      <div class="foot">
        <div class="user">
          <div class="user-img">
            <img :src="bigAvaImg" />
          </div>
          <div class="user-text">{{ blogNickName }}</div>
        </div>
        <div class="hot">{{ numberFormat(hotCount) }}热度</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { numberFormat } from "@/utils/numberFormat";
//粮仓列表item
const props = defineProps([
  "bigAvaImg",
  "blogNickName",
  "hotCount",
  "digest",
  "orign",
  "tag",
  "id",
  "goToHomeItem"
])

</script>

<style lang="scss" scoped>
.granary-list-item-type-one {
  width: 96vw;
  margin: 10px auto;
  display: flex;

  .left-img {
    width: 75px;
    height: 75px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .right-text {
    margin-left: 10px;

    .title {
      div {
        height: 16px;
        overflow: hidden;

        ::v-deep(p) {
          font-size: 13px;
          font-weight: normal;
          margin: 0;
          font-weight: bolder;
          width: 60vw;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }

    .tag {
      margin: 7px 0 13px 0;

      span {
        padding: 3px 6px;
        font-size: 12px;
        color: #bfbfbf;
        border-radius: 10px;
        background-color: #f5f5f5;
      }
    }

    .foot {
      display: flex;
      align-items: center;

      .user {
        display: flex;
        align-items: center;

        .user-img {
          img {
            width: 20px;
            height: 20px;
            border-radius: 999px;
            margin-right: 3px;
          }
        }
      }

      .user-text,
      .hot {
        max-width: 150px;
        margin-right: 20px;
        font-size: 12px;
        color: #bfbfbf;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }
}
</style>